home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / clipMenuCommands.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  3.3 KB  |  115 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Methods called from the trax and visor popup menus.
  19. //
  20. global proc clipApplyPoseMenuCommand(string $clip)
  21. {
  22.      string $character[] = `clip -q -ch $clip`;
  23.     if (size($character) > 0)
  24.     {
  25.         // apply the clip
  26.         for ($c in $character) {
  27.             string $poseCmd = ("pose -apply -name "+$clip+" "+$c);
  28.             evalEcho($poseCmd);
  29.         }
  30.     } else {
  31.         string $errorStr = ($clip+" is not attached to a character (use copy and paste to apply it to a character).");
  32.         error($errorStr);
  33.     }
  34. }
  35.  
  36.  
  37. global proc
  38. clipDuplicateMenuCommand(string $clip)
  39. {
  40.      string $characters[] = `clip -q -ch $clip`;
  41.      string $topCharacters[];
  42.     if (size($characters) > 0)
  43.     {
  44.         // Schedule an duplicate of the clip at the current time
  45.         //
  46.         string $curTime = `currentTime -query`;
  47.         
  48.         if (size($characters) == 1) {
  49.             $topCharacters[0] = $characters[0];
  50.         } else {
  51.             // find the top level characters, duplicating them
  52.             // will also duplicate their subcharacters so we do not
  53.             // need to duplicate the subcharacters on their own
  54.             //
  55.             int $isSubCharacter[];
  56.             int $ii, $jj;
  57.             int $charCount = size($characters);
  58.             for ($ii = 0; $ii < $charCount; $ii++) {
  59.                 $isSubCharacter[$ii] = 0;
  60.                 for ($jj = 0; $jj < $charCount; $jj++) {
  61.                     if ($ii == $jj) continue;
  62.                     if (`character -isMember $characters[$jj] $characters[$ii]`)
  63.                     {
  64.                         $isSubCharacter[$ii] = 1;
  65.                         break;
  66.                     }
  67.                 }
  68.                 if (0 == $isSubCharacter[$ii]) {
  69.                     $topCharacters[size($topCharacters)] = $characters[$ii];
  70.                 }
  71.             }
  72.         }
  73.             
  74.         // duplicate the clip
  75.         //
  76.         for ($c in $topCharacters) {
  77.             string $cmd = ("clip -startTime "+$curTime);
  78.             $cmd += (" -duplicate -name "+$clip+" "+$c);
  79.             evalEcho $cmd;
  80.         }
  81.     } else {
  82.         string $errorStr = ($clip+" is not attached to a character (use copy and paste to apply it to a character).");
  83.         error($errorStr);
  84.     }
  85. }
  86.  
  87.  
  88. global proc
  89. clipInstanceMenuCommand(string $clip )
  90. {
  91.     string $characters[] = `clip -q -ch $clip`;
  92.     if (size($characters) > 0)
  93.     {
  94.         string $curTime = `currentTime -query`;
  95.  
  96.         // Schedule an instance of the clip.
  97.         string $c;
  98.         for ($c in $characters) {
  99.             string $sch = `character -q -sc $c`;
  100.             string $cmd = ("clipSchedule -start "+$curTime+" -in "+$clip+" "+$sch);
  101.             evalEcho $cmd;
  102.         }
  103.     } else {
  104.         string $errorStr = ($clip+" is not attached to a character (use copy and paste to apply it to a character).");
  105.         error($errorStr);
  106.     }
  107. }
  108.  
  109. global proc
  110. clipCopyMenuCommand(string $clip)
  111. {
  112.     string $cmdString = ("clip -copy "+$clip);
  113.     evalEcho($cmdString);
  114. }
  115.